package com.sicilin.dao;

import com.sicilin.po.TSysUser;
import com.sicilin.po.TSysUserRole;
import com.sicilin.system.login.dto.LoginUser;
import com.sicilin.system.role.dto.Role;
import com.sicilin.system.user.dto.User;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

public interface UserDao {
    int saveUser(TSysUser user);

    int existAccount(@Param("account") String account);

    int existUser(@Param("account") String account,@Param("password") String password,@Param("status") int status);

    List<User> searchUserLimit(@Param("searchText") String searchText, @Param("start") int start, @Param("size") int size,@Param("companyId") int companyId);

    int countSearchUser(@Param("searchText") String searchText,@Param("companyId") int companyId);

    User findUserbyId(@Param("userId")int userId);

    User findUserByAccount(@Param("account") String account);

    int updateUser(User user);

    List<Role> getUserRoleByUserId(@Param("userId") int userId,@Param("own") boolean own);

    List<Role> getUserOweRoleByUserId(@Param("userId") int userId,@Param("level") int level);

    int addUserRole(Collection<TSysUserRole> userRoles);

    int removeUserRole(Collection<TSysUserRole> userRoles);

    int existName(@Param("name") String name);

    LoginUser findLoginUserByAccount(@Param("account") String account);

    int updateStatus(@Param("userId") int userId,@Param("status") int status,@Param("companyId") int companyId);
}
